package com.selftool.gui.devframe;

import com.selftool.base.NCFrame;
import com.selftool.gui.devframe.action.ExpButton;
import com.selftool.gui.devframe.action.ImpButton;

import javax.swing.*;

/**
 * 研发管理补丁安装界面
 */
public class DevFrom extends NCFrame {
    private JPanel main;
    private ImpButton imbutton = new ImpButton();
    private ExpButton exbutton = new ExpButton();
    private JTable patchlist;
    TableModel myTableModel;


    public JPanel getMain(){
        return main;
    }
    public DevFrom(){
        imbutton.setFrame(this);
        exbutton.setFrame(this);
        initTable();
    }
    //获取补丁列表数据模型
    public TableModel getModel(){
       return (TableModel)this.patchlist.getModel();
    }

    private void initTable() {
//        Object[] titles = {"补丁组", "补丁名称", "安装时间", "备注"};
//
//        //创建二维数组，存储数据
//        Object[][] data = {
//                {"SIP合并补丁", "问题修复01", "2023-08-14 17:50:20", ""},
//                {"SIP合并补丁", "问题修复02", "2023-08-14 17:50:21", ""},
//                {"SIP合并补丁", "问题修复03", "2023-08-14 17:50:22", ""}};
//
//
//        titlesV = new Vector();
//        dataV = new Vector();
//        for (int i = 0; i < titles.length; i++) {
//            titlesV.add(titles[i]);
//        }
//
//        for (int i = 0; i < data.length; i++) {
//            Vector t = new Vector<>();
//            for (int j = 0; j < data[i].length; j++) {
//                t.add(data[i][j]);
//            }
//            dataV.add(t);
//        }
        myTableModel = new TableModel();
        myTableModel.setTitles(TableModel.titel);
        myTableModel.refresh();
//        Object obj = JDBCUtil.getModel("bd_patch");
//        Logger.write(obj.toString());
        patchlist.setModel(myTableModel);
        patchlist.setFillsViewportHeight(true);
    }
}
